package com.wenxixuanwu.fruitstore.controller;

import com.wenxixuanwu.fruitstore.Vo.ProductVo;

import com.wenxixuanwu.fruitstore.entity.Product;
import com.wenxixuanwu.fruitstore.service.DetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DetailsController {

    @Autowired
    DetailsService service;


    @GetMapping("/fruit/selectById")
    public ProductVo selectById(int id) {
        System.out.println(service.selectById(id));
        return service.selectById(id);
    }
    @GetMapping("/fruit/selectfruits")
    public List<Product> getById(int id){
        int kid = service.getById(id);
        return service.selectByKind(kid);
    }
}
